//
//  InfoList.m
//  Trading365
//
//  Created by yifei tong on 12-1-10.
//  Copyright (c) 2012年 dhc. All rights reserved.
//

#import "InfoSum.h"


@implementation InfoSum

@synthesize quotationInfo;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (id)init
{    
	self = [super init];
        
	if(self)
	{
	}
	
	return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

- (void)dealloc
{    
    [super dealloc];
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [self init];
    [super viewDidLoad];
    [self.view setBackgroundColor:BACKGROUND_COLOR];

    // Do any additional setup after loading the view from its nib.
    
//    UIButton *barRetBut = [[UIButton alloc] initWithFrame:CGRectMake(5.0, 30.0, 50.0, 25.0)];
    UIButton *barRetBut = [[UIButton alloc] initWithFrame:CGRectMake(5.0, 27.0, 50.0, 30.0)];
    [barRetBut setTitle:@" 返回" forState:UIControlStateNormal];
    UIFont *font              = [UIFont systemFontOfSize:14];
    barRetBut.titleLabel.font = font;
    UIImage *barRetImageNormal = [UIImage imageNamed:PIC_MAIL_SWITCH_SELF_NORMAL];
    [barRetBut setBackgroundImage:barRetImageNormal forState:UIControlStateNormal];
    UIImage *barRetImagePressed = [UIImage imageNamed:PIC_MAIL_SWITCH_SELF_PRESS];
    [barRetBut setBackgroundImage:barRetImagePressed forState:UIControlStateHighlighted];
    [barRetBut addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.leftBarButtonItem  =  [[UIBarButtonItem alloc]initWithCustomView:barRetBut];
    self.navigationItem.leftBarButtonItem.enabled = NO;
    
}

- (void)viewDidDisappear:(BOOL)animated
{

}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - Table view delegate
//Jason-子类需要复写该方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //
}

#pragma mark - Table view data source
//Jason-子类需要复写该方法
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = (UITableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                       reuseIdentifier: CellIdentifier] autorelease];
    }
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.backgroundColor = [UIColor clearColor];
    cell.backgroundView.backgroundColor = [UIColor clearColor];
    
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 1;
}

#pragma mark - 
#pragma mark - my function
-(void)goBack
{
    [[self navigationController] popViewControllerAnimated:YES];
}

//Jason-子类需要复写该方法
-(void)refreshData
{    
//    NSLog(@"InfoList refreshData.");
//    [[[TaskManager Share] GetTaskByType:GetInfoList Delegate:self] Excute];
}

-(void) OnPreExcute
{
//    [super OnPreExcute];
    spinner = [[TKLoadingAnimationView alloc] initWithFrame:CGRectMake(140, 155, 30, 30) 
                                tkLoadingAnimationViewStyle:TKLoadingAnimationViewStyleCarton];
	
	[self.view addSubview:spinner];
	[spinner startAnimating];
	[spinner release];
}

//Jason-子类需要复写该方法
-(void) DoInBackground
{
}

-(void) OnPostExcute
{    
//    [super OnPostExcute];
    self.navigationItem.leftBarButtonItem.enabled=YES;
    
    [spinner stopAnimating];
}

@end
